import static org.junit.Assert.*;

import java.io.IOException;
import org.junit.Test;

public class resource_leak_test {
  // FIXME: It does not trigger the bug.
  @Test
  public void test() {
    my_output out = null;
    try {
      out = resource_leak.foo();
    } catch (IntendedException e) {
      // Do nothing.
    } catch (IOException e) {
      assertNull(e);
    }
    assertNotNull(out);
    // Write after close.
    my_output final_out = out;
    assertThrows(IOException.class, () -> final_out.write(0));
  }
}
